<?php
// +----------------------------------------------------------------------
// | 海豚PHP框架 [ DolphinPHP ]
// +----------------------------------------------------------------------
// | 版权所有 2016~2017 河源市卓锐科技有限公司 [ http://www.zrthink.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://dolphinphp.com
// +----------------------------------------------------------------------
// | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

namespace app\admin\model;

use think\Model;

/**
 * 日志记录模型
 * @package app\admin\model
 */
class Activityvideo extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = '__ADMIN_ACTIVITY_VIDEO__'; //scenicspot
    // 自动写入时间戳


    public static function getAll($map='',$fileds='',$order = 'id desc',$type='2')
    {


        if($type == '1'){

            $data_list = self::alias('b')->where($map)->field($fileds)
                ->join('cafe_admin_attachment a','a.id=b.pic','left')
                ->order($order)->select();
        }else{
            $data_list = self::where($map)->field($fileds)->order($order)->paginate();
        }

        return $data_list;
    }

    public static function getApiData($map='del=0',$field,$order='solid asc,id desc')
    {
            $data_list = self::where($map)->field($field)
                ->order($order)->select();

        return $data_list;
    }

    //获取单个内容
    public static function getInfo($map='',$fileds='',$order = 'id desc')
    {
        $data_list = self::where($map)->field($fileds)->order($order)->find();
        return $data_list;
    }


    //查询数量
    public static function getCnt($map='')
    {
        $data_list = self::where($map)->count();
        return $data_list;
    }

    //执行添加的
    public static function saveData($data,$mtas = '')
    {
        if($mtas == ''){
            return   $data_list = self::insert($data);
        }
        return  $data_list = self::where($mtas)->setField($data);
    }




}